package com.tanhua.server.controller;

import com.tanhua.model.vo.PeachblossomSoundVo;
import com.tanhua.server.service.PeachBlossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachBlossomService peachblossomService;

    /**
     *      发送传音
     * @return
     */
    @PostMapping()
    public ResponseEntity add(MultipartFile soundFile){
        peachblossomService.add(soundFile);
        return ResponseEntity.ok(null);
    }

    /**
     *        接收传音
     * @return
     */
    @GetMapping
    public ResponseEntity getSound(){
        PeachblossomSoundVo vo = peachblossomService.getSound();
        return ResponseEntity.ok(vo);
    }
}
